<?php

if(!empty($_FILES)){
	
	$img=$_FILES['img'];
	$ext = strtolower(substr($img['name'],-3));
	$allow_ext= array("jpg","png","gif");
	if (in_array($ext,$allow_ext))
	{
		move_uploaded_file($img['tmp_name'],"/opt/lampp/htdocs/sitepoisson/images/".$img['name']);
	}
	else
	{
		$erreur="votre fichier n'est pas une taille image correcte";
		echo $erreur;

	}
}


?>


<?php

	$dos="/opt/lampp/htdocs/sitepoisson/images/";
	$dir=opendir($dos);
	while($file=readdir($dir))
	{
		$allow_ext= array("jpg","png","gif");
		$ext = strtolower(substr($file,-3));
		if (in_array($ext,$allow_ext))
		{

			echo "<img src='images/".$file."' />";	
		}
	}
?>
